<?php 
/**
 * Get all types place
 */
$response = array();
// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

$sql = "SELECT * FROM LOAI_DIA_DIEM";
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) > 0){
	$response["place_types"] = array();
	while($row = mysql_fetch_array($result)){
		$place_type = array();
		$place_type["id"] = $row["id"];
		$place_type["TEN_DIA_DIEM"] = $row["TEN_LOAI_DIA_DIEM"];
		
		array_push($response["place_types"], $place_type);
	}
	// success
	$response["success"] = 1;
	// echoing JSON response
	echo utf8_encode(json_encode($response));
}else {
    // no products found
    $response["success"] = 0;
    $response["message"] = "No place types found";
 
    // echo no users JSON
    print utf8_encode(json_encode($response));
}
?>